<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="../template/layout.xhtml">
	<ui:define name="titulo">#{utenteControle.tituloPagina}</ui:define>

	<ui:define name="frConteudo">
		<h:form>
			<h:panelGrid columns="1" border="0" height="100%">
			<!-- bloco de edição -->
			<p:panel header="#{utenteControle.tituloPagina}" rendered="#{utenteControle.estadoCrud}">
					<h:panelGrid columns="1" >
						<f:facet name="header">
							<p:messages id="msgErro" />
						</f:facet>
						
			<h:panelGrid columns="2" border="0" rendered="#{!utenteControle.estadoFormVazio}">
				<h:outputLabel value="#{msg.utenteNumeroMec}" for="numeroMec" />
							<h:inputText id="numeroMec" label="#{msg.utenteNumeroMec}"
							value="#{utenteControle.infoBean.numeroMec}" required="true"
							requiredMessage="#{msg.utenteNumeroMecRequiredMessage}" />


				<h:outputLabel value="#{msg.utente}" for="nome" />
							<h:inputText id="nome" label="#{msg.utente}"
							value="#{utenteControle.infoBean.nome}" required="true"
							requiredMessage="#{msg.utenteRequiredMessage}" />

				<h:outputLabel value="#{msg.area}" for="area" />
                             <h:selectOneMenu id="area" value="#{utenteControle.infoBean.area}"
                              required="true" requiredMessage="#{msg.areaRequiredMessage}" >
                              <f:selectItems value="#{areaControle.itemsAvailableSelectOne}"/>
                              </h:selectOneMenu>

				<f:facet name="footer">
					<h:panelGroup>
						<center>
							<h:commandButton id="salvarButton" value="#{msg.salvarButton}"
								action="#{utenteControle.gravar}"
								rendered="#{utenteControle.estadoAdicionar}" />
							<h:commandButton id="alterarButton" value="#{msg.alterarButton}"
								action="#{utenteControle.gravar}"
								rendered="#{utenteControle.estadoActualizar}" />
							<h:commandButton id="eliminarButton"
								value="#{msg.eliminarButton}" action="#{utenteControle.excluir}"
								rendered="#{utenteControle.estadoEliminar}"
								onclick="if(!confirm('Confirma a exclusão do registo?')) return false;" />
							<h:commandButton id="limparButton" value="#{msg.limparButton}"
								type="reset" rendered="#{utenteControle.estadoAdicionar}" />
							<h:commandButton id="cancelarButton"
								value="#{msg.cancelarButton}" action="#{utenteControle.voltar}"
								immediate="true" />
						</center>
					</h:panelGroup>
				</f:facet>
			</h:panelGrid>
			</h:panelGrid>
					</p:panel>
					<!-- fim do bloco de edição -->
				</h:panelGrid>
			<h:commandLink action="#{utenteControle.voltar}" immediate="true"
				value="#{msg.geralLinkListaRegistos}" />
		</h:form>
	</ui:define>
</ui:composition>
</html>